#include<bits/stdc++.h>
int main()
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	int time1 = a*60 + b;
	int time2 = c*60 + d;
	
	int time3 = time2 - time1;
	int ans1 = time3 / 60;
	int ans2 = time3 % 60;
	
	printf("%d %d",ans1,ans2);
	return 0;
}
